#ifndef CAN_H
#define CAN_H

#include "CAN_Cfg.h"

#if(MCU_PLATFORM == S32K1XX)
#include "canCom.h"
#include "flexcan_driver.h"
#endif


typedef struct
{
    int a;      //TODO
}Can_ConfigPtrType;

typedef enum
{
  CAN_NOT_OK = 0,
  CAN_OK = 1,
  CAN_NOT_SUPPORTED = 3,
  CAN_REQUESTED = 4
} Can_ReturnType;


typedef uint16 Can_IdType;
typedef uint8 *Can_SduPtrType;
typedef uint8 PduIdType;

typedef struct Can_PduTypeTag
{
  Can_IdType id;
  uint8 length;
  Can_SduPtrType sdu;
  PduIdType swPduHandle;
} Can_PduType;

typedef uint8 Can_HwHandleType;
typedef Can_PduType	*Can_PduInfoPtrType;


extern flexcan_data_info_t tx_info;
extern flexcan_data_info_t rx_info;

/***************************************************************************
* function prototypes / AUTOSAR API                                       
***************************************************************************/
void Can_Init( Can_ConfigPtrType *ConfigPtr );
Std_ReturnType Can_SetBaudrate( uint8 Controller, uint16 BaudRateConfigID );
Can_ReturnType Can_Write( Can_HwHandleType Hth, Can_PduInfoPtrType PduInfo );

/* polling functions (always available for non polled systems also) */
void Can_MainFunction_Write( void );
void Can_MainFunction_BusOff( void );
void Can_MainFunction_Read( void );
void Can_MainFunction_Wakeup( void );

void CanBusOffInterrupt( void );
void CanMailboxInterrupt( void );


#endif
